
wx.config({
    debug: false,
    appId: '{$SignPackage["appId"]}',
    timestamp: {$SignPackage["timestamp"]},
    nonceStr: '{$SignPackage["nonceStr"]}',
    signature: '{$SignPackage["signature"]}',
    jsApiList: [
      // 所有要调用的 API 都要加到这个列表中
	  'chooseImage',
	  'uploadImage',
    ]
});
wx.ready(function () {
    // 在这里调用 API

});

$(".send-btn-file").click(function(){
	var images = {
		localId: [],
		serverId: []
	};
	wx.chooseImage({
	  count: 1,
	  success: function (res) {
		images.localId = res.localIds;
		//alert('已选择 ' + res.localIds.length + ' 张图片,'+images.localId);
		//var imgStr = '<img src="'+images.localId+'"  style="height:auto;width:50px" onclick="popBigPic(this)">';
		setTimeout(function(){
		wx.uploadImage({
			localId: images.localId.toString(),
			isShowProgressTips: 1,
			success: function (res) {
				$.get("/Home/Upload/get_media",{
					serverId:res.serverId,  
				},function(data){

					var imgStr = '<img src="'+data+'"  style="height:auto;width:50px" onclick="popBigPic(this)">';
					$('.send-content').html( $('.send-content').html()+imgStr);
					base64Str=data;
				})
			},
			fail: function (res) {
				alert(res);
			}
		})},0)
	  }
	});
});